<?php if (isset($form_data)): ?>

    <table class="table table-striped table-condensed">
        <tr>
            <td>Filter</td>
            <td>
                <?php echo form_open($form_data['form_target'], 'style="margin:0;"'); ?>
                <?php echo form_input($form_data['facht_filter']); ?>
            </td>
            <td>
                <?php
                if (!empty($form_data['faculties']) && !empty($form_data['selected'])) {
                    echo form_dropdown('Fachbereich_Filter', $form_data['faculties'], $form_data['selected']);
                } else {
                    echo form_dropdown('Fachbereich_Filter', array(''));
                }
                ?>
            <td>
                <div class="input-prepend input-append">
                    <span class="add-on">Größer-Gleich</span>
    <?php echo form_input($form_data['bedarf_filter']); ?>
                </div>
            </td>
            <td>
                <input type="submit" name="filter_submit" value="Filter anwenden" class="btn btn-info">

            </td>
            <td>
    <?php echo anchor('/catalogue/clear_filters?' . $add, 'Filter reset', 'class="btn"'); ?>
    <?php echo form_close(); ?>
            </td>
            </td>
        </tr>
        <tr><th>ID</th><th>Fachthema</th><th>Fachbereich</th><th>Bedarf</th><th>Preis</th><th></th></tr>
    <?php
    if (!empty($results)) {
        foreach ($results as $row):
            ?>
                <tr>
                    <td><?php echo $row->course_id; ?> </td>
                    <td><?php echo anchor('/catalogue/details/' . $row->course_id, $row->coursetitle); ?></td>
                    <td><?php echo $row->facultytitle; ?></td>
                    <td><?php echo $row->demandamount; ?></td>
                    <td><?php echo number_format($row->costamount, 2, ',', '.'); ?>&euro;</td>
                    <td><?php
            echo form_open($course_form['target'], 'style="margin:0;"', $course_form['hidden']);
            echo form_input($course_form['button']);
            // echo anchor($target.'/'. $row->course_id. $stope, $btn['text'], 'class="'. $btn['css'] .'"'); 
            echo '<input type="hidden" name="course_id" value="' . $row->course_id . '" />';
            echo form_close();
            ?></td>
                </tr>
                    <?php
                    endforeach;
                }
                else
                    echo '<tr>
                <td colspan="5">';
                if (!isset($results)) {
                    echo '<div class="alert alert-warning">
                        Keine Schulungen mit dem Namen "' . $form_data['facht_filter']['value'] . '" und dem Fachbereich "' . $form_data['selected'] . '" gefunden!
                    </div>';
                }
                echo '
                </td>
              </tr>';
                ?>

    </table>


    <div class="pagination">
    <?php echo $links; ?>
    </div>

<?php endif; ?>